#include "ComponentHumanModelBase.h"

#include "Components/ComponentBody.h"
#include "Components/ComponentLocomotion.h"
#include "Components/ComponentCreature.h"

#include "Log.h"
#include "GameSingleton.h"
#include "GameRegistry.hpp"
#include "GameThreadPool.hpp"


namespace PocketSurvival
{
    void ComponentHumanModelBase::update(float dt)
    {
        eyePositionClear();
        eyeRotationClear();
    }

    std::shared_ptr<Vector3> ComponentHumanModelBase::calculateEyePosition()
    {
        Matrix matrix = componentCreature->componentBody->getMatrix();
        float bob = componentCreature->componentLocomotion->lookAngles.posY / 1.5f;
        float f = 0.0f;
        float num = 1.0f;
        float num2 = 0.875f * componentCreature->componentBody->boxSize.posY;
        float num3 = MathUtils::Lerp(MathUtils::Lerp(num2, 0.45f * num2, num), 0.2f * num2, f);

        Vector3 position;
        componentCreature->componentBody->getPosition(position);

        return std::make_shared<Vector3>(position + matrix.getUp() * (num3 + 2.0f * bob) + matrix.getForward() * (0.4f) + Vector3(0,0.75f,0));
    }

    static const std::string componentName = "HumanModel";
    const std::string &ComponentHumanModelBase::getName() const
    {
        return componentName;
    }
    const std::string &ComponentHumanModelBase::GetName()
    {
        return componentName;
    }

} // namespace PocketSurvival
